<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>无缝连续滚动特效</title>
</head>

<body>


  <style>
    * {
      margin: 0;
      padding: 0;
    }

    .box {
      width: 1000px;
      height: 130px;
      border: 1px solid #000;
      margin: 50px auto;
      overflow: hidden;
      left: 20px;
    }

    .box ul {
      list-style: none;
      /* 设置大一点，这样li才能浮动 */
      width: 5000px;
      position: relative;
    }

    .box ul li {
      float: left;
      margin-right: 10px;
    }
  </style>

  <div id="box" class="box">
    <ul id="list">
      <li>
        <img src="https://sofile.cn/wp-content/uploads/img_test/1.jpg" alt="" />
      </li>
      <li>
        <img src="https://sofile.cn/wp-content/uploads/img_test/1.jpg" alt="" />
      </li>
      <li>
        <img src="https://sofile.cn/wp-content/uploads/img_test/1.jpg" alt="" />
      </li>
      <li>
        <img src="https://sofile.cn/wp-content/uploads/img_test/1.jpg" alt="" />
      </li>
      <li>
        <img src="https://sofile.cn/wp-content/uploads/img_test/1.jpg" alt="" />
      </li>
      <li>
        <img src="https://sofile.cn/wp-content/uploads/img_test/1.jpg" alt="" />
      </li>
    </ul>
  </div>
</body>
<script>
  var ulObject = document.getElementById("list");
  var div = document.querySelector("div");
  ulObject.innerHTML += ulObject.innerHTML;
  // 跑起来
  var left = 0;
  var a = 0;

  function move() {
    a = setInterval(function () {
      if (left == -1260) {
        left = 0;
      }
      left -= 5;
      ulObject.style.left = left + "px";
    }, 10);
  }
  // 定义好的函数要调用才会执行
  move();
  // 当鼠标移入的时候，间隔执行函数停止
  ulObject.onmouseenter = function () {
    clearInterval(a);
  };

  // 鼠标移出的时候，继续执行间隔执行函数
  ulObject.onmouseleave = function () {
    move();
  };
</script>

</html>